<table width="100%" border="1" cellspacing="5" cellpadding="5" class="tbl_border">
  <tr>
    <td bgcolor="#3399FF"><form id="form2" name="form1" method="post" action="index.php?page=weapon_filter&&cattegory"><select name="filter_cat" id="filter_cat">
        <?php
		if(isset($_GET['filter_cat'])){
			if($_GET['filter_cat'] == 'all'){
		?>
        <option value="all" selected="selected">All Weapon</option>
        <option value="riffle">Riffle</option>
        <option value="smg">SMG</option>
        <option value="awp">Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'riffle'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" selected="selected">Riffle</option>
        <option value="smg">SMG</option>
        <option value="awp">Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'smg'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" selected="selected">SMG</option>
        <option value="awp">Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'awp'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp" selected="selected">Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'shotgun'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp">Sniper</option>
        <option value="shotgun" selected="selected">Shootgun</option>
        <option value="machinegun">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'machinegun'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp" >Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun" selected="selected">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'melee'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp" >Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun" >Machine Gun</option>
        <option value="melee" selected="selected">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'handgun'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp" >Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun" >Machine Gun</option>
        <option value="melee" >Melee</option>
        <option value="handgun" >Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'explosive'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp" >Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun" >Machine Gun</option>
        <option value="melee" >Melee</option>
        <option value="handgun" >Handgun</option>
        <option value="explosive" selected="selected" >Explosive</option>
        <option value="special">Special</option>
        <?php
			}elseif($_GET['filter_cat'] == 'special'){
		?>
        <option value="all" >All Weapon</option>
        <option value="riffle" >Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp" >Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun" >Machine Gun</option>
        <option value="melee" >Melee</option>
        <option value="handgun" >Handgun</option>
        <option value="explosive" >Explosive</option>
        <option value="special" selected="selected">Special</option>
        <?php
			}
		}else{
		?>
        <option value="all">All Weapon</option>
        <option value="riffle">Riffle</option>
        <option value="smg" >SMG</option>
        <option value="awp">Sniper</option>
        <option value="shotgun">Shootgun</option>
        <option value="machinegun">Machine Gun</option>
        <option value="melee">Melee</option>
        <option value="handgun">Handgun</option>
        <option value="explosive">Explosive</option>
        <option value="special">Special</option>
        <?php
		}
		?>
      </select>
      <input type="submit" name="button4" id="button4" value="Filter" />
    </form></td>
    <td width="23%" align="center" bgcolor="#3399FF"><a href="index.php?page=add_weapon"><img src="assets/image/add_btn.png" width="50" height="51" alt="Add" /></a></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#3399FF"><a href="index.php?page=weapon_filter&amp;sharingan=gcash&amp;opsi=asc">G-Cash</a> | <a href="index.php?page=weapon_filter&point">Point</a></td>
    <td align="center" bgcolor="#3399FF"><form name="form1" method="post" action="index.php?page=weapon_filter&amp;&amp;pencarian">
      <input type="text" name="search" id="search">
      <input type="submit" name="button" id="button" value="Search">
    </form></td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%" border="1" cellspacing="4" cellpadding="4" class="tbl_border">
      <tr>
        <td bgcolor="#333333" class="judul" align="center">#</td>
        <td bgcolor="#333333" class="judul" align="center">Picture</td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=item_name&&opsi=asc">Item Name</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=cattegory&&opsi=asc">Cattegory</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=mark&&opsi=asc">Mark</td>
        <td bgcolor="#333333" class="judul" align="center">Duration &amp; Price</td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=damage&&opsi=asc">Damage</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=fire_speed&&opsi=asc">Fire Speed</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=accuracy&&opsi=asc">Accuracy</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=ammo_1&&opsi=asc">Ammo</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=v_recoil&&opsi=asc">V. Recoil</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=h_recoil&&opsi=asc">H. Recoil</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=move_speed&&opsi=asc">Move Speed</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=ranger&&opsi=asc">Range</a></td>
        <td bgcolor="#333333" align="center"><a href="index.php?page=weapon_filter&&sharingan=status&&opsi=asc">Status</a></td>
        <td bgcolor="#333333" class="judul" align="center">Config</td>
      </tr><?php
$kueri = mysql_query("select * from tbl_weapon ORDER BY item_name ASC");
$kueri_row = mysql_num_rows($kueri);
//echo $kueri_row;
if($kueri_row == 0){
?>
	<tr>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
      </tr>
<?php
}else{
	$no=0;
	$setrip = "&nbsp;-&nbsp;";
	while($data = mysql_fetch_array($kueri))
	{
		$no++;
		if($no%2){
			$pelangi = "class=\"ganjil\"";	
		}else{
			$pelangi = "class=\"genap\"";	
		}
	?>
		<tr <?=$pelangi;?>>
		  <td align="center"><?=$no;?></td>
		  <td>
		  <?php
		  if($data['id_weapon'] == NULL){
			echo $setrip;  
		  }else{
		  ?>
		  	<?php if($leveling == 3){ echo""; }else{ ?>
		  <a href="index.php?page=edit_weapon&&id=<?=$data['id_weapon'];?>">
		  	<?php } ?>
		  <img alt="Picture" width="242px" src="assets/picture/<?=$data['picture'];?>" />
		  </a>
		  <?php
		  }
		  ?>
		  </td>
		  <td class="judul"><font color="#FFFFFF"><?=$data['item_name'];?></font></td>
		  <td align="center">
          <?php
		  if($data['cattegory'] == 'riffle'){
			echo "Riffle";  
		  }elseif($data['cattegory'] == 'shotgun'){
			  echo "Shotgun"; 
		  }elseif($data['cattegory'] == 'smg'){
			  echo "SMG"; 
		  }elseif($data['cattegory'] == 'awp'){
			  echo "Sniper"; 
		  }elseif($data['cattegory'] == 'handgun'){
			  echo "Hand Gun"; 
		  }elseif($data['cattegory'] == 'melee'){
			  echo "Melee"; 
		  }elseif($data['cattegory'] == 'machinegun'){
			  echo "Machine Gun"; 
		  }elseif($data['cattegory'] == 'explosive'){
			  echo "Explosive"; 
		  }elseif($data['cattegory'] == 'special'){
			  echo "Special"; 
		  }
		  ?>
          </td>
		  <td align="center">
		  <?php
		  if($data['mark'] == "hot"){
			echo "HOT";  
		  }elseif($data['mark'] == "new"){
			echo "NEW";  
		  }elseif($data['mark'] == "regular"){
			echo "REGULAR";  
		  }else{
			echo"ERROR";  
		  }	
		  ?>
		  </td>
		  <td align="center">
		  <?php
				if($data['tipe'] == "gcash"){
					echo "1 Day : $data[one_day] <br />3 Day : $data[three_day] <br />7 Day : $data[seven_day] <br />30 Day : $data[thirty_day] <br />";
				}elseif($data['tipe'] == "point"){
					echo "$data[point_unit] Unit : $data[point_price] Point";	
				}
		  ?></td>
		  <td align="center"><?=$data['damage'];?></td>
		  <td align="center"><?=$data['fire_speed'];?></td>
		  <td align="center"><?=$data['accuracy'];?></td>
		  <td align="center"><?=$data['ammo_1'];?> / <?=$data['ammo_2'];?></td>
		  <td align="center"><?=$data['v_recoil'];?></td>
		  <td align="center"><?=$data['h_recoil'];?></td>
		  <td align="center"><?=$data['move_speed'];?></td>
		  <td align="center"><?=$data['ranger'];?></td>
		  <td align="center">
		  <?php
		  if($data['status'] == "sell"){
			echo "SELL";  
		  }elseif($data['status'] == "not sell"){
			echo "NOT SELL";  
		  }else{
			echo"ERROR";  
		  }	
		  ?>
		  </td>
		  <td align="center"><?php if($leveling == 3){ echo""; }else{ ?><a href="index.php?page=edit_weapon&&id=<?=$data['id_weapon'];?>">Edit</a><br /><?php if($leveling == 2){ echo""; }else{ ?><a href="delete_weapon.php?id=<?=$data['id_weapon']; ?>">Delete</a><?php } ?><?php } ?></td>
		</tr>
		<?php
	}
}
	?>
    </table></td>
  </tr>
</table>
